package org.omg.IOP;

/**
 * Generated from IDL definition of struct "IOR"
 * 
 * @author IDL compiler
 */

public class IORHelper {
	// private static org.omg.CORBA.TypeCode _type =
	// org.omg.CORBA.ORB.init().create_struct_tc(org.omg.IOP.IORHelper.id(),"IOR",new
	// org.omg.CORBA.StructMember[]{new
	// org.omg.CORBA.StructMember("type_id",org.omg.CORBA.ORB.init().create_string_tc(0),null),new
	// org.omg.CORBA.StructMember("profiles",org.omg.CORBA.ORB.init().create_sequence_tc(0,
	// org.omg.CORBA.ORB.init().create_struct_tc(org.omg.IOP.TaggedProfileHelper.id(),"TaggedProfile",new
	// org.omg.CORBA.StructMember[]{new
	// org.omg.CORBA.StructMember("tag",org.omg.CORBA.ORB.init().create_alias_tc(
	// org.omg.IOP.ProfileIdHelper.id(),"ProfileId",org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.from_int(5))),null),new
	// org.omg.CORBA.StructMember("profile_data",org.omg.CORBA.ORB.init().create_sequence_tc(0,
	// org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.from_int(10))),null)})),null)});
	private static org.omg.CORBA.TypeCode _type;

	public IORHelper() {
	}

	public static void insert(org.omg.CORBA.Any any, org.omg.IOP.IOR s) {
		any.type(type());
		write(any.create_output_stream(), s);
	}

	public static org.omg.IOP.IOR extract(org.omg.CORBA.Any any) {
		return read(any.create_input_stream());
	}

	public static org.omg.CORBA.TypeCode type() {
		return _type;
	}

	public static String id() {
		return "IDL:omg.org/IOP/IOR:1.0";
	}

	public static org.omg.IOP.IOR read(org.omg.CORBA.portable.InputStream in) {
		org.omg.IOP.IOR result = new org.omg.IOP.IOR();
		result.type_id = in.read_string();
		int _lresult_profiles1 = in.read_long();
		result.profiles = new org.omg.IOP.TaggedProfile[_lresult_profiles1];
		for (int i = 0; i < result.profiles.length; i++) {
			result.profiles[i] = org.omg.IOP.TaggedProfileHelper.read(in);
		}

		return result;
	}

	public static void write(org.omg.CORBA.portable.OutputStream out,
			org.omg.IOP.IOR s) {
		out.write_string(s.type_id);

		out.write_long(s.profiles.length);
		for (int i = 0; i < s.profiles.length; i++) {
			org.omg.IOP.TaggedProfileHelper.write(out, s.profiles[i]);
		}

	}
}
